package cn.edu.nju.software.cdiy.action.user.all;

import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;

import cn.edu.nju.software.cdiy.service.SchemeService;
import cn.edu.nju.software.cdiy.util.Constant;

import com.opensymphony.xwork2.ActionSupport;

@SuppressWarnings("serial")
public class SchemeRankAction extends ActionSupport implements SessionAware {

	private Map<String, Object> session;
	private SchemeService schemeService;

	@Override
	public void setSession(Map<String, Object> session) {
		this.session = session;
	}
	
	public void setSchemeService(SchemeService schemeService) {
		this.schemeService = schemeService;
	}

	@Override
	public String execute() throws Exception {
		if (!session.containsKey(Constant.S_RANKLIST_TIME)) {
			session.put(Constant.S_RANKLIST_TIME, schemeService.getTimeRankList());
			session.put(Constant.S_RANKLIST_SALE, schemeService.getSaleRankList());
			session.put(Constant.S_RANKLISTS_BRAND, schemeService.getBrandRankLists());
			session.put(Constant.S_RANKLISTS_PRICE, schemeService.getPriceRankLists());
			session.put(Constant.S_RANKLISTS_TYPE, schemeService.getTypeRankLists());
		}
		return SUCCESS;
	}

}
